import {request} from '@/utils/request'

/**
 * 创建支付订单（API V3）
 */
export async function createPaymentV3(orderNo: string, openid: string) {
  return request({
    url: '/v3/payment',
    method: 'POST',
    needAuth: true,
    data: {
      order_no: orderNo,
      openid
    }
  })
}

/**
 * 查询支付状态（API V3）
 */
export async function queryPaymentStatusV3(orderNo: string) {
  return request({
    url: `/v3/payment/${orderNo}`,
    method: 'GET',
    needAuth: true,
  })
}

/**
 * 申请退款（API V3）
 */
export async function refundPaymentV3(orderNo: string, refundReason?: string) {
  return request({
    url: '/v3/payment/refund',
    method: 'POST',
    needAuth: true,
    data: {
      order_no: orderNo,
      refund_reason: refundReason
    }
  })
}
